const knowManageApi = {
    /**
     * 全部知识库列表
     *
     * @param {string} [bot] 智能体编号
     * @returns {Promise<KnowManageWholeResponse[]>}
     * @author zero
     */
    whole(bot?: string): Promise<KnowManageWholeResponse[]> {
        return $request.get<KnowManageWholeResponse[]>({
            url: '/agent/know/manage/whole',
            params: {
                bot
            }
        })
    },

    /**
     * 知识库列表(分页)
     *
     * @param params
     * @param {number} [params.page_no] 当前页码
     * @param {number} [params.page_size] 每页条数
     * @param {string} [params.keyword] 搜索关键字
     * @param {string} [params.owner] 拥有者: [all=全部, private=私有, cooperate=协作]
     * @returns {Promise<KnowManageListResponse[]>}
     * @author zero
     */
    lists(params: {
        page_no?: number;
        page_size?: number;
        keyword?: string;
        owner?: string; // 拥有者: [all=全部, private=私有, cooperate=协作]
    }): Promise<KnowManageListResponse[]> {
        return $request.get<KnowManageListResponse[]>({
            url: '/agent/know/manage/lists',
            params
        })
    },

    /**
     * 知识库详情
     *
     * @param {string} code 知识库编号
     * @returns {Promise<KnowManageDetailResponse>}
     * @author zero
     */
    detail(code: string): Promise<KnowManageDetailResponse> {
        return $request.get<KnowManageDetailResponse>({
            url: '/agent/know/manage/detail',
            params: { code }
        })
    },

    /**
     * 知识库新增
     *
     * @param params
     * @param {string} params.logo 知识库图标
     * @param {string} params.name 知识库名称
     * @param {string} params.intro 知识库简介
     * @param {string} params.vector_model 向量模型
     * @param {string} params.splits_model 分词模型
     * @returns {Promise<any>}
     * @author zero
     */
    add(params: {
        logo: string;
        name: string;
        intro: string;
        vector_model: string;
        splits_model: string;
    }): Promise<any> {
        return $request.post({
            url: '/agent/know/manage/add',
            params
        })
    },

    /**
     * 知识库编辑
     *
     * @param params
     * @param {string} params.code 知识库编号
     * @param {string} params.logo 知识库图标
     * @param {string} params.name 知识库名称
     * @param {string} params.intro 知识库简介
     * @param {string} params.vector_model 向量模型
     * @param {string} params.splits_model 分词模型
     * @returns {Promise<any>}
     * @author zero
     */
    edit(params: {
        code: string;
        logo: string;
        name: string;
        intro: string;
        vector_model: string;
        splits_model: string;
    }): Promise<any> {
        return $request.post({
            url: '/agent/know/manage/edit',
            params
        })
    },

    /**
     * 知识库删除
     *
     * @param {string} code 知识库编号
     * @returns {Promise<any>}
     * @author zero
     */
    delete(code: string): Promise<any> {
        return $request.post({
            url: '/agent/know/manage/delete',
            params: {
                code
            }
        })
    },

    /**
     * 变更向量模型
     *
     * @param params
     * @param {string} params.code 知识库编号
     * @param {string} params.vector_model 向量模型
     * @returns {Promise<any>}
     * @author zero
     */
    change_vector(params: {
        code: string,
        vector_model: string
    }): Promise<any> {
        return $request.post({
            url: '/agent/know/manage/change_vector',
            params
        })
    }
}

export default knowManageApi
